﻿// -----------------------------------------------------------------------
// <copyright file="SaveForm.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Metal.CommonForms
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    /// <summary>
    /// Saves a file
    /// </summary>
    public partial class SaveForm : Form
    {
        /// <summary>
        /// Initializes a new instance of the SaveForm class.
        /// </summary>
        /// <param name="strTitle">Message title</param>
        /// <param name="strMessage">The message to show in the dialog form</param>
        public SaveForm(string strTitle, string strMessage)
        {
            this.InitializeComponent();

            this.Text = strTitle;
            this.lblTitle.Text = strMessage;
        }

        /// <summary>
        /// Gets the name of the new file
        /// </summary>
        public string FileName
        {
            get
            {
                return this.fileName.Text;
            }
        }

        /// <summary>
        /// Saves the file
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event args</param>
        private void ButtonOk_Click(object sender, EventArgs e)
        {
            try
            {
                ////string path = System.IO.Path.GetDirectoryName(oldFilePath);

                ////if (this.fileName.Text != string.Empty)
                ////{
                ////    System.IO.File.Move(oldFilePath, path + "\\" + this.newName.Text + this.fileExtension);
                ////}

                this.Close();
            }
            catch (Exception ex)
            {
                Metal.User.UserMessage.ShowError(ex);
            }
        }

        /// <summary>
        /// Cancel saving
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event args</param>
        private void ButtonCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
